﻿using System;
using System.Configuration;

namespace PhotoGallery.Infrastructure.Roots.Configuration
{
    public abstract class NamedConfigurationElementBase : System.Configuration.ConfigurationElement
    {
        private const string NameItem = "name";
        private const string DescriptionItem = "description";

        [ConfigurationProperty(NameItem, IsKey = true, IsRequired = true)]
        public virtual string Name
        {
            get { return base[NameItem] as string; }
        }

        [ConfigurationProperty(DescriptionItem, IsKey = false, IsRequired = false)]
        public virtual string Description
        { get { return base[DescriptionItem] as string; } }
    }

    public class ModuleElement : NamedConfigurationElementBase
    {
        private const string ValueItem = "value";

        [ConfigurationProperty(ValueItem, IsRequired = true)]
        public string Value
        {
            get { return base[ValueItem] as String; }
        }
    }
}
